package cn.iocoder.yudao.module.crossborder.platform.dal.mysql.platformmapping;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.platform.dal.dataobject.platformmapping.PlatformMappingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.platform.controller.admin.platformmapping.vo.*;

/**
 * 跨境电商数据映射配置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PlatformMappingMapper extends BaseMapperX<PlatformMappingDO> {

    default PageResult<PlatformMappingDO> selectPage(PlatformMappingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PlatformMappingDO>()
                .eqIfPresent(PlatformMappingDO::getPlatformId, reqVO.getPlatformId())
                .eqIfPresent(PlatformMappingDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(PlatformMappingDO::getMappingType, reqVO.getMappingType())
                .eqIfPresent(PlatformMappingDO::getLocalField, reqVO.getLocalField())
                .eqIfPresent(PlatformMappingDO::getPlatformField, reqVO.getPlatformField())
                .eqIfPresent(PlatformMappingDO::getLocalValue, reqVO.getLocalValue())
                .eqIfPresent(PlatformMappingDO::getPlatformValue, reqVO.getPlatformValue())
                .eqIfPresent(PlatformMappingDO::getDataType, reqVO.getDataType())
                .eqIfPresent(PlatformMappingDO::getTransformRule, reqVO.getTransformRule())
                .eqIfPresent(PlatformMappingDO::getIsRequired, reqVO.getIsRequired())
                .eqIfPresent(PlatformMappingDO::getDefaultValue, reqVO.getDefaultValue())
                .eqIfPresent(PlatformMappingDO::getValidationRule, reqVO.getValidationRule())
                .eqIfPresent(PlatformMappingDO::getSort, reqVO.getSort())
                .eqIfPresent(PlatformMappingDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PlatformMappingDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(PlatformMappingDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PlatformMappingDO::getId));
    }

}